package de.tabuma.pm.security.controller;

import de.tabuma.ssoclient.entity.*;
import de.tabuma.lib.contentmanagement.FacadeInterface;
import java.util.*;
import java.util.logging.*;

/**
 * @author $Author: alefen $
 * @version $Revision: 1.1.1.1.6.1 $
 * @since $Date: 2010/01/13 10:19:31 $
 */
public class GroupFacade implements FacadeInterface {
    private static Logger log = Logger.getLogger(GroupFacade.class.getName());

    private String ssoId;
    public String getSsoId() {
        return ssoId;
    }
    public void setSsoId(String ssoId) {
        this.ssoId = ssoId;
    }
    
    public int createElement(Object object, String user) {
        try {
            return (int) de.tabuma.ssoclient.logik.GroupFacade.create((Group) object, ssoId);
        }
        catch(Exception e) {
            String warning = e.getMessage()+"/"+e.getCause()+"/"+e.getClass()+"\n";
            for(int i=0;i<e.getStackTrace().length;i++) {
                warning += e.getStackTrace()[i]+"\n";
            }
            log.warning(warning);
        }
        return 0;
    }
    public void updateElement(Object object, String user) {
        try {
            de.tabuma.ssoclient.logik.GroupFacade.update((Group) object, ssoId);
        }
        catch(Exception e) {
            String warning = e.getMessage()+"/"+e.getCause()+"/"+e.getClass()+"\n";
            for(int i=0;i<e.getStackTrace().length;i++) {
                warning += e.getStackTrace()[i]+"\n";
            }
            log.warning(warning);
        }
    }
    public void removeElement(int id, String user) {
        try {
            de.tabuma.ssoclient.logik.GroupFacade.remove(id, ssoId);
        }
        catch(Exception e) {
            String warning = e.getMessage()+"/"+e.getCause()+"/"+e.getClass()+"\n";
            for(int i=0;i<e.getStackTrace().length;i++) {
                warning += e.getStackTrace()[i]+"\n";
            }
            log.warning(warning);
        }
    }
    public Object getElement(int id) {
        try {
            return de.tabuma.ssoclient.logik.GroupFacade.get(id, ssoId);
        }
        catch(Exception e) {
            String warning = e.getMessage()+"/"+e.getCause()+"/"+e.getClass()+"\n";
            for(int i=0;i<e.getStackTrace().length;i++) {
                warning += e.getStackTrace()[i]+"\n";
            }
            log.warning(warning);
        }
        return null;
    }
    public List getElementList(String listParameter) {
        try {
            return de.tabuma.ssoclient.logik.GroupFacade.getList(ssoId);
        }
        catch(Exception e) {
            String warning = e.getMessage()+"/"+e.getCause()+"/"+e.getClass()+"\n";
            for(int i=0;i<e.getStackTrace().length;i++) {
                warning += e.getStackTrace()[i]+"\n";
            }
            log.warning(warning);
        }
        return null;
    }
}
